package com.wangzhenyu.learn.test.designPattern


//策略模式

@Suppress("UNUSED")
object WStrategyPattern {

    interface SwimStrategy {
        fun swim()
    }

    class ATypeSwim : SwimStrategy {
        override fun swim() {
            println("ATypeSwim")
        }
    }

    class BTypeSwim : SwimStrategy {
        override fun swim() {
            println("BTypeSwim")
        }
    }

    class CTypeSwim : SwimStrategy {
        override fun swim() {
            println("CTypeSwim")
        }
    }

    class Swimmer(private val strategy: SwimStrategy) {
        fun swim() {
            strategy.swim()
        }
    }

}





